import reducer from '@/reducers/calculator'
import { SET_NUMBER, CHANGE_METHOD } from '@/actions/calculator'

// 'SET_NUMBER', this.field, val
// 'CHANGE_METHOD', this.method
export default (ctx) => {
  const {
		setNumber,
		changeMethod
  } = reducer(ctx.$data)

  return function (type, ...args) {
		switch (type) {
			case SET_NUMBER:
				ctx.result = setNumber(...args)
				break
			case CHANGE_METHOD:
				ctx.result = changeMethod(...args)
				break
			default:
				break
		}
  }
}